<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8" />
    <title>06组件</title>
    <script type="text/javascript" src="../js/vue.js"></script>
</head>

<body>
    <div id="demo">
       <School></School>
    </div>
    <script type="text/javascript">
        Vue.config.productionTip = false
       const School = Vue.extend({
           template:`
            <div>
                <h2>学校名称:{{sname}}</h2>
                <h2>学校地址:{{address}}</h2>
                <button @click="sname+='~'">修改学校名称</button>
                <button @click="welcome">欢迎同学</button>
            </div>
            `,
            data() {
                return {
                    sname: '尚硅谷',
                    address:'宏福科技园'
                }
            },
            methods: {
                welcome(){
                    alert(`${this.sname}欢迎你!`)
                }
            }
        
        })
        new Vue({
            el: '#demo',
            components:{
				School
				
			}
        })
    </script>
</body>

</html>